<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>amCharts examples</title>
        <link rel="stylesheet" href="../amcharts/style.css" type="text/css">
        <script src="../../js/jquery-1.4.4.min.js" type="text/javascript"></script>
        <script src="../../amcharts/amcharts.js" type="text/javascript"></script>
        <script src="../../amcharts/pie.js" type="text/javascript"></script>

        <script>

           /* $(function () {
                $.ajax({
                    url:"statChartAction_ajax.action",
                    dataType:"json",
                    success:function (data) {
                        alert(JSON.stringify(data));
                    },
                    timeout:3000
                });
            });*/

            /*var chart;

           var chartData;


          function  createPic() {

                   // SERIAL CHART
                   chart = new AmCharts.AmSerialChart();
                   chart.dataProvider = chartData;
                   chart.categoryField = "factory";
                   chart.startDuration = 1;

                   // AXES
                   // category
                   var categoryAxis = chart.categoryAxis;
                   categoryAxis.labelRotation = 90;
                   categoryAxis.gridPosition = "start";

                   // value
                   // in case you don't want to change default settings of value axis,
                   // you don't need to create it, as one value axis is created automatically.

                   // GRAPH
                   var graph = new AmCharts.AmGraph();
                   graph.valueField = "value";
                   graph.balloonText = "[[category]]: <b>[[value]]</b>";
                   graph.type = "column";
                   graph.lineAlpha = 0;
                   graph.fillAlphas = 0.8;
                   chart.addGraph(graph);

                   // CURSOR
                   var chartCursor = new AmCharts.ChartCursor();
                   chartCursor.cursorAlpha = 0;
                   chartCursor.zoomable = false;
                   chartCursor.categoryBalloonEnabled = false;
                   chart.addChartCursor(chartCursor);

                   chart.creditsPosition = "top-right";

                   chart.write("chartdiv");

           }*/

           $(function () {
               var chart;
               var legend;
               chart = new AmCharts.AmPieChart();
               chart.titleField = "factory";
               chart.valueField = "value";
               chart.outlineColor = "#FFFFFF";
               chart.outlineAlpha = 0.8;
               chart.outlineThickness = 2;

               $.post(
                   "statChartAction_ajaxFactorysale.action",
                   "",
                   function (data) {
                       /* chartData = data;
                        createPic();*/
                       chart.dataProvider = data;
                       // WRITE
                       chart.write("chartdiv");
                   },
                   "json"
           );
           });
        </script>
    </head>

    <body>
        <div id="chartdiv" style="width: 100%; height: 400px;"></div>
    </body>

</html>